/*
		ServEngine framework library
		A library to fast develop JEE online applications
	
		Copyright 2008 José Ignacio de Córdoba Álvaro

		Licensed under the Apache License, Version 2.0 (the "License");
		you may not use this file except in compliance with the License.
		You may obtain a copy of the License at

				http://www.apache.org/licenses/LICENSE-2.0

		Unless required by applicable law or agreed to in writing, software
		distributed under the License is distributed on an "AS IS" BASIS,
		WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
		See the License for the specific language governing permissions and
		limitations under the License.
	
		Jose Ignacio de Cordoba Alvaro
		http://ignacio.decordoba.com
*/

package com.servengine.portal;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;

@Entity
public class Annotation implements java.io.Serializable
{
	protected Integer id;
	protected Date date;
	protected Portal portal;
	protected String body;
	public Annotation()
	{
	}
	public Annotation(Portal portal, String annotationText)
	{
		this.portal=portal;
		date = new Date();
		this.body = annotationText;
	}
	@Id @GeneratedValue
	public Integer getId()			{return id;}
	public boolean equals(Object o)
	{
		return ((Annotation)o).getId().equals(id);
	}

	public java.util.Date getDate()	{return date;}
	@ManyToOne(fetch=FetchType.LAZY,optional=false)
	public Portal getPortal()	{return portal;}
	@Lob
	public String getBody()		{return body;}

	public void setId(Integer id)
	{
		this.id = id;
	}

	public void setDate(Date date)
	{
		this.date = date;
	}

	public void setPortal(Portal portal)
	{
		this.portal = portal;
	}

	public void setBody(String annotationText)
	{
		this.body = annotationText;
	}
}
